--
-- Author: shunguo.chen
-- Date: 2016-10-20 15:51:48
--
-- RewardLoginVo

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

function ClassRef:ctor(data)
	if data then
		self:init(data)
	end
end

-- data = {
-- 		day=奖励所属day,
-- 		today=今天,
-- 		isGot=是否已经领取奖励,
-- 		rewards=奖励,
-- }
function ClassRef:init(data)
	self.isGot = data.isGot
	self.day = data.day
	self.today = data.today

	local ary = string.split(data.rewards, ";")
	local rewards = {}
	for _, reward in ipairs(ary) do
		if #reward > 0 then
			local itemData = UD:parseRewardToBagItem(reward)
			table.insert(rewards, itemData)
		end
	end
	self.rewards = rewards
end

function ClassRef:setTomorrowData(cb, isShowTime)
	self._getTimeCb = cb
	self.isShowTime = isShowTime
end

function ClassRef:getNextTime()
	return executeFunc(self._getTimeCb) or 0
end

function ClassRef:isToday()
	return self.today == self.day
end

function ClassRef:isTomorrow()
	return (self.today + 1) == self.day
end

return ClassRef